<template>
  <div class="app-container pagebox">
    <div class="bg " style="width: 80%;margin: 20px auto">

      <div >
        <a-table :columns="columns" :data-source="data" :pagination="false" >

          <span slot="lookmore" slot-scope="text, record" style="text-align: center"  @click="toProcess(record)"><a-icon type="right"  style="color:#999;font-size:20px;font-weight: bold "/></span>
        </a-table>
        <div style="padding:20px">
 <a-pagination size="small" :total="total" :show-total="total => `一共 ${total} 条`"  @change="chanangepage"/>
        </div>
        
      </div>
    </div>
  </div>
</template>
<script>
//
const columns = [
  {
    title: "上传时间",
    dataIndex: "createTime",
  },
  {
    title: "伺机人员",
    dataIndex: "operator"
  },
  {
    title: "电话号码",
    dataIndex: "phone"
  }, {
    title: "设备编号",
    dataIndex: "macNumb"
  },  {
    title: "用户",
    dataIndex: "company"
  },
{
  title: "查看详情",
    dataIndex: "lookmore",
  scopedSlots: { customRender: 'lookmore' },
},
];

let colorList=['#FF3535','#FF7865','#FFBB00','#f8d77e'];
import api from "@/api/deviceInfo.js";
export default {
  data() {
    return {
      data:[],
      columns,
      form: {  },
      options1: [{ name: "生产车间1", value: 1 }, { name: "生产车间2", value: 2 }],
      options2: [{ name: "2333", value: 1 }, { name: "3444", value: 2 }],
      colorList:colorList,
      visible:false,
      macsn:'',
      groupid:'',
      params:{
          macSn:'',
          page:1,
          pageSize:10
      },
      total:0
    };
  },
  created() {
    this.params.macSn=this.macsn=this.$route.query.macsn;
    this.groupid=this.$route.query.groupid;
    this.SelectAllAndMacinfo()
  },
  methods: {
  
     chanangepage(page, size) {
      this.params.page = page;
      this.SelectAllAndMacinfo();
    },
    SelectAllAndMacinfo(){
      api.SelectSingleMacNcpInfo(this.params).then(res=>{
          if(res.rows){
            this.data=res.rows.content?res.rows.content:[]
          }else{
              this.data=[]
          }
          this.total=res.rows?res.rows.total?res.rows.total:0:0
      })
    },
    hideModal(){
      this.visible=false
    },
    toProcess(data){
       localStorage.setItem('machineReportData', '')
      localStorage.setItem('machineReportData', JSON.stringify(data))
      this.$router.push( {path:'/debugHistory',query:{macsn:this.macsn,groupid:this.groupid}} )
      this.visible=true
    },
    handleChange(){

    },
    onChangeEnd(){

    },
    onChangestart(date, dateString){
    },
    handleSubmit() {

    }
  }
};
</script>
<style scoped lang="less">
@import "./index.less";
</style>
